using System;
using UnityEngine;
using UnityEngine.UI;

namespace CGF
{
    //该脚本自动生成或覆盖，不可编辑
    public partial class TabWallet
    {   
		public Text TextID;
		public CButton BtnDetail;
		public Text WalletBalance;
		public Text WalletDetail;
		public CButton BtnRecharge;
		public CButton BtnWithdraw;
		public CButton BtnMoreDeviceIncome;
		public CButton BtnMoreSalesIncome;
		public Text DeviceIncomeTitle;
		public Text SalesIncomeTitle;
		public RectTransform DeviceIncomeCart;
		public RectTransform SalesIncomeCart;
		public ScrollRect ScrollView;
		public CButton BtnCopyID;
		public Banner Banner;
		public Image Page0;
		public Image Page1;
		public CButton VIPIcon;
		public Text VIPText;
		public I18N i18n;

        public Reference reference { get; private set; }
        public Action onProsBindCompleted;
        public bool isProsBindCompleted;
        
        public void BindProperties(Transform transform)
        {   
            reference = transform.GetComponent<Reference>();
            if(!reference)return;
            int nodeIndex = 0;
			TextID = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			BtnDetail = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			WalletBalance = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			WalletDetail = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			BtnRecharge = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			BtnWithdraw = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			BtnMoreDeviceIncome = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			BtnMoreSalesIncome = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			DeviceIncomeTitle = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			SalesIncomeTitle = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			DeviceIncomeCart = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<RectTransform>();
			SalesIncomeCart = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<RectTransform>();
			ScrollView = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<ScrollRect>();
			BtnCopyID = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			Banner = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Banner>();
			Page0 = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			Page1 = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			VIPIcon = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			VIPText = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			i18n = transform.GetComponent<I18N>();
            isProsBindCompleted = true;
            onProsBindCompleted?.Invoke();
        }
        
        public void SetProsBindCompletedAction(Action action)
        {
            if (isProsBindCompleted)
            {
                action?.Invoke();
            }
            else
            {
                onProsBindCompleted = action;
            }
        }

		public string I18N_can_use { get { return i18n.GetTextByKey("can_use"); } }
		public string I18N_cannot_use { get { return i18n.GetTextByKey("cannot_use"); } }
		public string I18N_total_income { get { return i18n.GetTextByKey("total_income"); } }
		public string I18N_devices_count { get { return i18n.GetTextByKey("devices_count"); } }
		public string I18N_today_income { get { return i18n.GetTextByKey("today_income"); } }
    }
}
